#include <iostream>
#include <algorithm>
#include <vector>
#include <stack>
#include <memory.h>

#define MAXN 10005
using namespace std;

int n, m;
int dfn[MAXN], low[MAXN], color[MAXN];
vector <int> G[MAXN];
int sum, deep;
stack<int> s;

template<typename T> 
void clear(stack<T> &q ) {
   stack<T> empty;
   swap(q, empty);
}

void tarjan (int u) {
	deep++;
	dfn[u] = deep;
	low[u] = deep;
	//vis[u] = 1;
	s.push(u);
	for (int i = 0; i < G[u].size(); i++) {
		int v = G[u][i];
		if (!dfn[v]) {
			tarjan(v);
			low[u] = min(low[u], low[v]);
		} else {
			if (!color[v]) {
				low[u] = min(low[u], low[v]);
			}
		}
	}
	if (dfn[u] == low[u]) {
		//vis[u] = 0;
		sum++;
		color[u] = sum;
		while (s.top() != u) {
			color[s.top()] = sum;
			s.pop();
		}
		s.pop();
	}
}

int main() {
	while (1) {
		cin >> n >> m;
		if (n == 0 && m == 0) break;
		
		sum = 0; deep = 0;
		memset(dfn, 0, sizeof(dfn));
		memset(low, 0, sizeof(low));
		memset(color, 0, sizeof(color));
		for (int i = 0; i <= n; ++i) G[i].clear();
		clear(s);
		
		int x, y;
		for (int i = 1; i <= m; ++i) {
			cin >> x >> y;
			G[x].push_back(y);
		}
		tarjan(1);
		
		bool flag = 1;
		for (int i = 1; i <= n; ++i) {
			if (!color[i]) {
				flag = 0;
				break;
			}
		}
		
		cout << ((sum == 1 && flag) ? "Yes" : "No") << endl;
	}
	return 0;
}
